package com.iclub.service.impl;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iclub.dao.MerchantDao;
import com.iclub.model.Merchant;
import com.iclub.model.UserMerchantRelation;
import com.iclub.service.MerchantService;
import com.iclub.util.Constants;

@Service
public class MerchantServiceImpl extends BaseService implements MerchantService{
	
	@Override
	public Map<String, Object> selectMerchant(int merchantId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, Object> addMerchant(Merchant mer) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, Object> selectJoinMerchantList(Map<String, String> map) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, Object> selectMerchantList(Map<String, String> map) {
		Map<String,Object> res=new HashMap<String, Object>();
		List<Merchant> merlist=null;
		try {
			merlist=merchantDao.selectMerchantList(map);
			if(merlist!=null&&merlist.size()>0){
				res.put(Constants.KEY_RESCODE, Constants.SUCCESS_RESCODE);
				res.put(Constants.KEY_RESMSG, Constants.SUCCESS_RESMSG);
				res.put(Constants.KEY_RESCONTENT, merlist);
			}
			else{
				res.put(Constants.KEY_RESCODE, Constants.NORESULT_RESCODE);
				res.put(Constants.KEY_RESMSG, Constants.NORESULT_RESMSG);
			}
		} catch (SQLException e) {
			log_detail.error("查询商户列表信息,系统异常",e);
			res.put(Constants.KEY_RESCODE, Constants.FAIL_RESCODE);
			res.put(Constants.KEY_RESMSG, Constants.FAIL_RESMSG);
		}
		return res;
	}

	@Override
	public Map<String, Object> delMerchant(int merchantId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, Object> joinMerchant(UserMerchantRelation relation) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, Object> quitMerchant(UserMerchantRelation relation) {
		// TODO Auto-generated method stub
		return null;
	}

}
